<?php

namespace App\Http\Requests;

use Illuminate\Support\Arr;

class HousingsRequest extends FormRequest
{
    public function rules()
    {
        $id = (int) optional($this->route('housings'))->id;
        $rules = [
            'type' => 'string',
            'content'=>'string',
            'common_user_type'=>'string',
            'id'=>'string',
        ];

        if ($this->isMethod('put')) {
            $rules = Arr::only($rules, $this->keys());
        }

        return $rules;
    }

    public function messages()
    {
        return [
            //
        ];
    }

    public function attributes()
    {
        return [
            'type' => '字段名',
            'content' => '字段名',
            'common_user_type' => '字段名',
        ];
    }
}
